function findLandingSpot(matrix) {
  let landingSpot;
  const sumNeighbors = (matrix, i, j) => {
    const neighbors = [];
    // left
    if (j > 0) neighbors.push(matrix[i][j-1]);
    // right
    if (j < matrix[0].length - 1) neighbors.push(matrix[i][j+1]);
    // top
    if (i > 0) neighbors.push(matrix[i-1][j]);
    // bottom
    if (i < matrix.length - 1) neighbors.push(matrix[i+1][j]);
    return neighbors.reduce((acc, cur) => acc + cur, 0);
  }

  for (let i=0; i < matrix.length; i++) {
    for (let j=0; j < matrix[i].length; j++) {
      if (!matrix[i][j]) {
        if (!landingSpot) landingSpot = [i, j];
        else if (sumNeighbors(matrix, i, j) < sumNeighbors(matrix, ...landingSpot)) landingSpot = [i, j];
      }
    }
  }
  return landingSpot;
}


let output = findLandingSpot([
  [9, 0, 3], 
  [7, 0, 4], 
  [8, 0, 5]])
console.log(output)